package com.yidu.best.stock.stockTrade.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.yidu.best.stock.stockTrade.domain.StockTradeVo;
import com.yidu.best.stock.stockTrade.service.StockTradeService;
@Controller
@RequestMapping("/stockClearing/")
public class ClearingController {
	@Autowired
	private StockTradeService stockTradeService;

	public ClearingController() {
		super();
	}
	

	public ClearingController(StockTradeService stockTradeService) {
		super();
		this.stockTradeService = stockTradeService;
	}


	public StockTradeService getStockTradeService() {
		return stockTradeService;
	}

	public void setStockTradeService(StockTradeService stockTradeService) {
		this.stockTradeService = stockTradeService;
	}
	
	/**
	 * 加载股票交易数据信息
	 * @return
	 */
	@RequestMapping(value = "stockClearing")
	public String clearingList() {
		return "sys/stock/stockClearing";
		
	}
	/**
	 * 查找所有股票交易数据
	 * @param StockClearingVo 股票交易对象
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="stockTrades",method=RequestMethod.GET)
	public Map<String, Object> queryStockPlateDate(StockTradeVo stockTradeVo){
		Map<String, Object> stockPlateMap =stockTradeService.queryStockPlateByCriteriaWithPage(stockTradeVo); 
		return stockPlateMap;
	}
	
	@ResponseBody
	@RequestMapping(value="closeStock",method=RequestMethod.PUT)
	public boolean closeStock(String tradeStatus, String stockTradeId) {
		return stockTradeService.closeStock(tradeStatus, stockTradeId);
		
	}
	
}
